# Class: puppetmaster
# ===========================
#
# Full description of class puppetmaster here.
#
# Parameters
# ----------
#
# Document parameters here.
#
# * `sample parameter`
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# Variables
# ----------
#
# Here you should define a list of variables that this module would require.
#
# * `sample variable`
#  Explanation of how this variable affects the function of this class and if
#  it has a default. e.g. "The parameter enc_ntp_servers must be set by the
#  External Node Classifier as a comma separated list of hostnames." (Note,
#  global variables should be avoided in favor of class parameters as
#  of Puppet 2.6.)
#
# Examples
# --------
#
# @example
#    class { 'puppetmaster':
#      servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
#    }
#
# Authors
# -------
#
# Author Name <author@domain.com>
#
# Copyright
# ---------
#
# Copyright 2018 Your name here, unless otherwise noted.
#
class puppetmaster {
  file{ "/root/.gitconfig":
    mode       =>  '0644',
    owner      =>  0,
    group      =>  0,
    source     =>  "puppet:///modules/${module_name}/gitconfig",
  }
  
  #file{ "/root/.git-credentials":
  #  mode       =>  '0600',
  #  owner      =>  0,
  #  group      =>  0,
  #  source     =>  "puppet:///modules/${module_name}/git-credentials",
  #}

  file{ "/root/bin/update_module.sh":
    mode       =>  '0755',
    owner      =>  0,
    group      =>  0,
    source     =>  "puppet:///modules/${module_name}/update_module.sh",
  }

  file { "/etc/cron.d/update-module":
    mode       =>  '0644',
    owner      =>  'root',
    group      =>  'root',
    content    =>  "*/1 * * * * root (/root/bin/update_module.sh)\n",
  }


  package { "git":
    ensure => "installed",
  }

  package { "puppetserver":
    ensure => "installed",
  }
   package { "ruby":
    ensure => "installed",
  }


  file {"/etc/puppetlabs/code/environments":
    ensure  => link,
    force   =>  true,
    target   => "/dev/shm/ihep-module"
  }
}
